IMU calibration

ABSTRACT

A method of calibrating an inertial measurement unit, the method comprising: (a) collecting data from the inertial measurement unit while stationary as a first step; (b) collecting data from the inertial measurement unit while repositioning the inertial measurement unit around three orthogonal axes of the inertial measurement unit as a second step; (c) calibrating a plurality of gyroscopes using the data collected during the first step and the second step; (d) calibrating a plurality of magnetometers using the data collected during the first step and the second step; (e) calibrating a plurality of accelerometers using the data collected during the first step and the second step; (f) where calibrating the plurality of magnetometers includes extracting parameters for distortion detection and using the extracted parameters to determine if magnetic distortion is present within a local field of the inertial measurement unit.

CROSS REFERENCE TO RELATED APPLICATIONS

The present application is a continuation of U.S. Nonprovisional patent application Ser. No. 15/382,546, titled “IMU CALIBRATION,” filed Dec. 16, 2016, and claims the benefit of U.S. Provisional Patent Application Ser. No. 62/268,175, titled “IMU CALIBRATION,” filed Dec. 16, 2015, the disclosure of each of which is incorporated herein by reference.

INTRODUCTION TO THE INVENTION

The present disclosure is directed to methods and techniques for calibrating inertial measurement units (IMUs) and, more specifically, to methods and techniques that involve calibrating IMUs to account for local environments within which the IMUs operate.

It should be noted that Patent Cooperation Treaty application PCT/US14/69411, filed Dec. 9, 2014 is hereby incorporated by reference and appended hereto as Appendix A.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a graphical depiction of a ferromagnetic device mounted to an inertial measurement unit and being rotated around an X-axis.

FIG. 2 is a graphical depiction of the ferromagnetic device mounted to the inertial measurement unit of FIG. 1, being rotated around a Y-axis.

FIG. 3 is a graphical depiction of the ferromagnetic device mounted to the inertial measurement unit of FIG. 1, being rotated around a Z-axis.

DETAILED DESCRIPTION

The exemplary embodiments of the present disclosure are described and illustrated below to encompass inertial measurement units and methods of calibrating the same. Of course, it will be apparent to those of ordinary skill in the art that the embodiments discussed below are exemplary in nature and may be reconfigured without departing from the scope and spirit of the present invention. However, for clarity and precision, the exemplary embodiments as discussed below may include optional steps, methods, and features that one of ordinary skill should recognize as not being a requisite to fall within the scope of the present invention.

Many current devices make use of integrated sensor components to capture and track information related to the use, location, and status of the device. One such system, the inertial measurement unit (IMU), is used to track object motion. A common packaging of an IMU comprises a single integrated circuit (IC) consisting of multiple inertial sensors, which can be a combination of accelerometers, gyroscopes, and magnetometers. These three sensor types can also be separated into individual ICs populated on the same circuit board. These two cases (single IC and multiple ICs) can be considered the same for purposes of the instant disclosure.

For all such sensors of the IMU, a calibration step may be performed to ensure the proper referencing and operation in the local environment. For example, accelerometers may be calibrated to determine a reference with respect to the direction of gravity and gyroscopes may be calibrated to some known rotational velocity. Magnetometer calibration is more complex, as the process requires knowledge of the local magnetic field strength and direction at a multitude of magnetometer orientations. The local environment calibration can be carried out by hand or by machine. The minimum considerations for local environment calibration should involve maneuvering of the IMU around the three orthogonal axes of the IMU, and a stationary period.

For applications requiring highly reliable and reproducible calibration of an IMU, a calibration machine may be used. A calibration machine may be constructed so that it does not introduce additional magnetic distortion to the IMUs. The calibration machine should produce movement for calibration for all the sensors of the IMU as well as movement in order for an algorithm to inspect the quality of the calibration.

The process for calibrating measurements from uncalibrated accelerometers, gyroscopes, and magnetometers of an IMU is described hereafter. This exemplary process is applicable to a single IMU or multiple IMUs populated on the same circuit board, where all sensors (uncalibrated accelerometers, gyroscopes, and magnetometers) may be calibrated simultaneously.

In exemplary form, the calibration procedure may include the following routines to allow adequate data to calculate and verify the calibration. This exemplary calibration comprises four stages that include, without limitation: (1) calibrating the gyroscopes; (2) calibrating the magnetometers routine; (3) calibrating the accelerometer routine; and, (4) calibrating the checking/validation routine.

Calibrating the gyroscopes of each IMU should provide for the gyroscopes being stationary for a set amount of time. As part of calibrating the gyroscopes, the instant process is determining the bias of the gyroscope by arithmetic mean as set forth in Equation 1 immediately below:

$\begin{matrix} {{{{Gyro}_{{mean}_{i}}\lbrack\ldots\rbrack} = {\overset{\_}{{DATA}_{{gyro}_{\iota}}}}_{{gyro}\mspace{14mu}{calibration}}},{i = 1},2,\ldots} & {{Equation}\mspace{14mu} 1} \end{matrix}$

Calibrating the magnetometers of each IMU should involve rotating the IMU around all of its orthogonal axes. In this fashion, this magnetometer calibration process first determines the soft and hard iron distortion using multi-dimensional Ellipsoidal Fitting function (EF_fun) set forth in Equation 2 immediately below:

$\begin{matrix} {{SFe}_{{orig}_{i}},{{HFe}_{{orig}_{i}} = {EF}_{{fun}{({{DATA}_{{mag}_{i}}{\lbrack{{{Mag}\mspace{14mu}{calibration}\mspace{14mu}{being}}->{end}}\rbrack}})}}},\mspace{20mu}{i = 1},2,\ldots} & {{Equation}\mspace{14mu} 2} \end{matrix}$ where: SFe_(orig) is the transformation of ellipsoid to sphere, and HFe_(orig) is the sensor and local bias.

The resultant data from Equation 2 are then processed using Equation 3, shown immediately below:

$\begin{matrix} {{procMAG}_{{orig}_{i}} = {{processMag}\left( {{{DATA}_{{mag}_{i}}\left. \quad{\left\lbrack {{{Acc}\mspace{14mu}{calibration}\mspace{14mu}{begin}}->{{end}\mspace{14mu}{of}\mspace{14mu}{checking}\mspace{14mu}{routine}}} \right\rbrack,{SFe}_{{orig}_{i}},{HFe}_{{orig}_{i}}} \right)},{i = 1},2,\ldots}\mspace{14mu} \right)}} & {{Equation}\mspace{14mu} 3} \end{matrix}$

Thereafter, the alignment differences among magnetometers are calibrated. In doing so, Equation 4 may be utilized, with the assumption that all magnetometers are aligned to a reference alignment using this equation. Alternatively, the magnetometers may be aligned to a different reference alignment if desired. In Equation 4, TMAG_(ij) represents the alignment transformation of magnetometer “j” to reference magnetometer “i”.

$\begin{matrix} {{{TMAG}_{ij} = {{procMAG}_{{orig}_{i}}\backslash{procMAG}_{{orig}_{i}}}},{i = 1},{j = 2},{3\mspace{14mu}\ldots}} & {{Equation}\mspace{14mu} 4} \end{matrix}$

Calibrating the accelerometers of each IMU should involve rotating the IMU around two axes perpendicular to gravity. In this fashion, the accelerometer calibration is calculated with the multi-dimensional Ellipsoidal Fitting function (EF_fun) set forth immediately below as Equation 5:

$\begin{matrix} {{AccScale}_{{orig}_{i}},{{AccBias}_{{orig}_{i}} = {EF}_{{fun}{({{DATA}_{{Acc}_{i}}{\lbrack{{{Acc}\mspace{14mu}{calibration}\mspace{14mu}{begin}}->{end}}\rbrack}})}}},{i = 1},2,\ldots} & {{Equation}\mspace{14mu} 5} \end{matrix}$

Calibrating the checking routine should involve rotating the IMU around the axis collinear with gravity. The result is best if the motion of the checking routine is performed multiple times at different angles with respect to gravity.

After calibrating the sensors, one may take into account manufacturing and IC assembly placement errors to extract or account for these errors. In this fashion, the instant disclosure includes a calibration sequence taking into account any mal-alignment among sensors, which are calibrated according to Equation 6-10 (applying the calibration parameters) provided immediately below. In doing so, all sensor data collected during the calibration may be subject to these calibration equations/parameters. procGyro_(i)=processGyro(DATA_(gyro) _(i) ,Gyro_(bias) _(i) ), i=1,2,  Equation 6 procAcc_(i)=processAcc(DATA_(Acc) _(i) ,ACC _(bias) _(i) ), i=1,2,  Equation 7 procMAG _(i)=processMag(DATA_(mag) _(i) ,SFe _(orig) _(i) ,HFe _(orig) _(i) ), i=1,2,  Equation 8 Continuing the example as aligning all magnetometer to the first one, alignProcMAG _(j)=procMAG _(j) *TMAG _(ij) , i=1, j=2,3  Equation 9 alignProcMAG_(i)=procMAG _(i)  Equation 10 With multiple IMUs rigidly fixed together, the aligned and calibrated signals should be roughly equal among each sensor type in the case of no noise or isotropic (to the sensor) noise.

Despite calibration with the local environment, magnetometers are especially prone to transient local disturbance. Specifically, introduction of additional ferromagnetic sources or movement of ferromagnetic sources after initial calibration (described previously) can distort the sensor signal and result in inaccurate readings. Distortion states can be classified as hard iron distortion, which is primary caused by the introduction of ferromagnetic materials such as steel tools that can deflect the field lines and produce an offset on the magnetometer sensors, and soft iron distortion, which is caused by an irregular magnetic field (such as magnets) that can alter the shape of the magnetic field. Given that these devices causing distortions will enter and exit the application field (area of use) of the IMU at unpredictable orientations, positions, and times, it is desirable that these distortions be detected and accounted for. By way of example, one area where distortions are commonplace is an operating room during a surgical procedure. More specifically, surgical instruments within an operating room are frequently repositioned within the operating field at different times and locations depending on the stage of the surgical procedure, which necessarily causes magnetic field distortions. It should be noted, however, that the exemplary disclosure is not limited to calibration of IMUs for surgical navigation or any particular field of use. Rather, the instant disclosure is applicable to calibrating any IMU in any field of use where local distortions may be present.

There are two essential parts to detect transient magnetic distortion. The first part is that the IMU must comprise two or more magnetometers (that may be populated on a common circuit board). The magnetometers are calibrated and aligned based the foregoing calibration teachings. The second part is the detection algorithm, which consists of two processes: (1) extracting parameters for distortion detection, which are calculated from the calibration data; and, (2) use of extracted parameters on captured IMU data to check if distortion is present.

What follows is a detailed explanation for calculating appropriate distortion threshold parameters. In general, one may use an algorithm for this calculation that may make use of the following assumptions: (1) IMU motion (or lack of motion) is detectable by all IMUs (accelerometer, gyroscope and magnetometer); (2) the angle and length of the calibrated magnetometers should have approximately identical values; (3) the calibrated magnetometer vectors should be approximately unity in magnitude; (4) the angle between the calibrated magnetometer vector and calibrated accelerometer vector should not change; (5) the radius of the calibrated magnetometers should be approximately equal to one; and, (6) the quaternions calculated using different magnetometers should be approximately equal.

Sufficient deviation from assumption 1 is deemed a motion anomaly and deviations from assumptions 2-6 are deemed a magnetic anomaly. Parameters for motion detection are calculated for each IMU sensor (accelerometer, gyroscope, and magnetometer) using data collected during local environment calibration. Using stationary and dynamic data, appropriate thresholds of motion are calculated for every IMU sensor, so that the calibrated IMU sensor output above the threshold indicates that the sensor is in motion and below which the sensor can be considered stationary (see Equation 2). A motion anomaly is considered to occur as in Table (2), which is described in more detail hereafter. In short, if a magnetometer has detected motion, but other sensors do not, a motion anomaly is said to exist.

For the magnetic anomaly, a deviation from assumption 2 is used to create a cost function, which is calculated as the magnitude of the vector difference weighted with the angular derivation between the vectors (see Algorithm 1 and Algorithm 4). During local environment calibration, expected values for the deviation from unity and from identical signals are calculated to form a cost function. The threshold is calculated from the value of this cost function during local environment calibration (when no additional distortion is presented). Then, as part of an anomaly detection process, any values of this cost function above the threshold are considered a magnetic anomaly.

For assumption 3, the magnetic strength is calculated as the mean of combined magnitudes (Algorithm (5)), which without noise is expected to be approximately 1. Then, as part of the anomaly detection process, any value outside the calculated magnetic strength (including a preset tolerance) is considered an anomaly.

For assumption 4, the derivation is calculated as the angular derivation between the magnetometer and the accelerometer vectors (Algorithm (6)). Then, as part of the anomaly detection process, any value outside the calculated angle (including a preset tolerance) is considered an anomaly.

For assumption 5, the deviation is calculated by using all of the magnetometer readouts, along with a preset of artificial points, to estimate a radius of the magnetic field using an ellipsoid estimation function as shown in Algorithm (7). The artificial points are used to support the estimation calculation. However, if the IMU contains more than 11 magnetometers, no artificial point is needed to resolve the radius. Then, as part of the anomaly detection process, any value outside the calculated radii (including a preset tolerance) is considered an anomaly.

For assumption 6, the deviation is determined by first calculating the orientation of the IMU using sensor fusion algorithm (e.g. Extended Kalman Filter) using different magnetometers as input, and an angular difference among the output orientation is calculated as shown in Algorithm (8). Then, as part of the anomaly detection process, any values greater than the angular different with a preset tolerance is considered an anomaly.

If motion or magnetic anomaly occurs, some unaccounted for magnetic distortion is present. An alert system for distortion provides feedback indicating the reliability of the orientation reported by the sensors may be inaccurate. What follows is a more detailed discussion of the algorithms utilized to detect motion and magnetic anomalies.

The anomaly detection is based on three categories of detection. The first is sensor fault detection, the second is magnetometer radii verification, and the third is quaternion output discrepancies. Sensor fault detection consists of the following functions: (i) motion and magnetic anomalies; (ii) magnetic strength; and (iii) angle between magnetometer and accelerometer vectors. The following method is used to consistently extract threshold values (TVs) for motion anomalies and cost functions from the calibration. The method utilizes Algorithm (1) as follows:

  Algorithm  (1) Iteration:  for  [beginning  of  gyro  calibration → end  of  checking  routines] $\mspace{79mu}{{{{Gyro}_{{mean}_{i}}\lbrack\;\ldots\;\rbrack} = {{\overset{\_}{procGyro}}_{{current} - {kernel}}^{current}}},{i = 1},2,\ldots}$ Gyro_(std_(i))[ … ] = std(procGyro[current − kernel → current]), i = 1, 2, … Acc_(std_(i))[ … ] = std(procAcc_(i)[current − kernel → current]), i = 1, 2, … Mag_(std_(i))[ … ] = std(alignProcMAG_(i)[current − kernel → current]), i = 1, 2, … $\mspace{79mu}{{{{lenDiff}_{i,j}\lbrack\;\ldots\;\rbrack} = \frac{\sqrt{\sum\limits_{axis}\left( {\sum\limits_{{current} - {kernel}}^{current}\begin{pmatrix} {{alignProcMAG}_{i} -} \\ {alignProcMAG}_{j} \end{pmatrix}^{2}} \right)}}{kernel}},\mspace{20mu}{i \neq j},{i = 1},{2\mspace{14mu}\ldots}\mspace{14mu},{j = 1},{2\mspace{14mu}\ldots}}$ $\mspace{20mu}{{{{angDiff}_{i,j}\lbrack\;\ldots\;\rbrack} = \frac{{1 - \begin{pmatrix} {{\overset{\_}{alignProcMAG}}_{l_{{current} - {kernel}}}^{current} \cdot} \\ {\overset{\_}{alignProcMAG}}_{J_{{current} - {kernel}}}^{current} \end{pmatrix}}}{\begin{matrix} {{{norm}\left( {\overset{\_}{alignProcMAGcur}}_{l_{{current} - {kernel}}}^{current} \right)} \cdot} \\ {{norm}\left( {\overset{\_}{alignProcMAG}}_{J_{{current} - {kernel}}}^{current} \right)} \end{matrix}}},\mspace{20mu}{i \neq j},{i = 1},{2\mspace{14mu}\ldots}\mspace{14mu},{j = 1},{2\mspace{14mu}\ldots\mspace{20mu}{{{metricLenAng}_{i,j}\lbrack\;\ldots\;\rbrack} = {{{lenDiff}_{i,j}\lbrack\;\ldots\;\rbrack}*{{angDiff}_{i,j}\lbrack\mspace{11mu}\ldots\mspace{11mu}\rbrack}}}},\mspace{20mu}{i \neq j},{i = 1},{2\mspace{14mu}\ldots}\mspace{14mu},{j = 1},{2\mspace{14mu}\ldots{{{currentMagVal}\;\lbrack\;\ldots\;\rbrack} = \frac{1}{{\max(i)}\left( {\sum\sqrt{\begin{matrix} {\sum\limits_{{current} - {kernel}}^{current}\;} \\ \left( {{alignProcMAG}_{l}*{alignProcMAG}_{J}} \right) \end{matrix}}} \right)}}},\mspace{20mu}{i \neq j},{i = 1},{2\mspace{14mu}\ldots}\mspace{14mu},{j = 1},{2\mspace{14mu}\ldots}}$   End

Once the iteration from Algorithm (1) is completed, the mu and sigma of the cost function can be determined using Equations 11 and 12, immediately recited below. μ=currentMagVal _(mag and acc calibration)  Equation 11 δ=SSF1*std(currentMagVal)_(mag and acc calibration)  Equation 12 Where: (a) SSF1 is a sensitivity scale factor; and,

(b) δ serves as the detection tolerance based on standard derivation (i.e., how many standard deviations away from the mean is considered acceptable).

Algorithm (2) is utilized to calculate motion and no motion (stationary) states for the sensors.

$\begin{matrix} {{{Stationary}_{{gyro}_{std}} = {\overset{\_}{{Gyro}_{std}}}_{{gyro}\mspace{14mu}{calibration}}}{{Motion}_{{gyro}_{std}} = {\overset{\_}{{Gyro}_{std}}}_{{acc}\mspace{14mu}{calibration}}}{{Stationary}_{{gyro}_{mean}} = {\overset{\_}{{Gyro}_{mean}}}_{{gyro}\mspace{14mu}{calibration}}}{{Motion}_{{gyro}_{mean}} = {\overset{\_}{{Gyro}_{mean}}}_{\;{{acc}\mspace{14mu}{calibration}}}}{{{Stationary}_{{Acc}_{i}} = {\overset{\_}{{Acc}_{\iota_{std}}}}_{{gyro}\mspace{14mu}{calibration}}},{i = 1},2,\ldots}{{{Motion}_{{Acc}_{i}} = {\overset{\_}{{Acc}_{\iota_{std}}}}_{{acc}\mspace{14mu}{calibration}}},{i = 1},2,\ldots}{{{Stationary}_{{MAG}_{i}} = {\overset{\_}{{MAG}_{\iota_{std}}}}_{{gyro}\mspace{14mu}{calibration}}},{i = 1},2,\ldots}{{{Motion}_{{MAG}_{i}} = {\overset{\_}{{MAG}_{\iota_{std}}}}_{{Checking}\mspace{14mu}{routine}}},{i = 1},2,\ldots}} & {{Algorithm}\mspace{14mu}(2)} \end{matrix}$ A check is performed here to ensure all motion states should have values greater than the corresponding stationary states.

Algorithm (3) is utilized to calculate TVs for motion anomalies.

$\begin{matrix} {{{TV}_{{gyro}_{std}} = {{{SSF}\; 2*\left( {{Motion}_{{gyro}_{std}} - {Stationary}_{{gyro}_{std}}} \right)} + {Stationary}_{{gyro}_{std}}}}{{TV}_{{gyro}_{mean}} = {{{SSF}\; 3*\left( {{Motion}_{{gyro}_{mean}} - {Stationary}_{{gyro}_{std}}} \right)} + {Stationary}_{{gyro}_{mean}}}}{{{TV}_{{Acc}_{i}} = {{{SSF}\; 4*\left( {{Motion}_{{Acc}_{i}} - {Stationary}_{{Acc}_{i}}} \right)} + {Stationary}_{{Acc}_{i}}}},{i = 1},2,\ldots}{{{TV}_{{MAG}_{i}} = {{{SSF}\; 5*\left( {{Motion}_{{MAG}_{i}} - {Stationary}_{{MAG}_{i}}} \right)} + {Stationary}_{{MAG}_{i}}}},{i = 1},2,\ldots}\mspace{20mu}{{{SSF}\; 2\mspace{14mu}{to}\mspace{14mu}{SSF}\; 5\mspace{14mu}{are}\mspace{14mu}{the}\mspace{14mu}{sensitivity}\mspace{14mu}{scale}\mspace{14mu}{{factor}.{It}}\mspace{14mu}{is}\mspace{14mu}{typically}\mspace{14mu}{set}\mspace{14mu}{between}\mspace{14mu} 0\mspace{14mu}{and}\mspace{14mu} 1},{{and}\mspace{14mu}{should}\mspace{14mu}{be}\mspace{14mu}{adjusted}\mspace{14mu}{based}\mspace{14mu}{on}\mspace{14mu}{sensors}\mspace{14mu}{and}\mspace{14mu}{desired}\mspace{14mu}{sensitivity}\mspace{14mu}{of}\mspace{14mu}{the}\mspace{14mu}{detection}\mspace{14mu}{{method}.}}}} & {{Algorithm}\mspace{14mu}(3)} \end{matrix}$

Determination of a magnetic anomaly may be based upon a cost function TV, which is accomplished by calculating the cost function over the period of the calibration period as set forth in Algorithm (4).

  Algorithm  (4) Iteration:  for  [beginning  of  gyro  calibration → beginning  of  Check  1] ${{pdfVal}\;\lbrack\;\ldots\;\rbrack} = {{\frac{1}{\sqrt{2\;\pi}*\delta}e^{{- 0.5}*{(\frac{({1 - \mu})}{\delta})}^{2}}} - {\frac{1}{\sqrt{{2\;\pi}\;}*\delta}e^{{- 0.5}*{(\frac{({{{currentMagVal}\;\lbrack\;\ldots\;\rbrack} - \mu})}{\delta})}^{2}}}}$ ${{{costFunction}\;\lbrack\;\ldots\;\rbrack} = {S\; S\; F\; 6*{{{{pdfVal}\;\lbrack\;\ldots\;\rbrack}*\frac{\sum{{metricLenAng}_{i,j}\lbrack\mspace{11mu}\ldots\mspace{11mu}\rbrack}}{\max(i)}}}}},\mspace{20mu}{i \neq j},{i = 1},{2\mspace{14mu}\ldots}\mspace{14mu},{j = 1},{2\mspace{14mu}\ldots}$   end TV _(costFunction)=max(costFunction)+(costFunction)+std(costFunction)

SSF6 is a scale factor that is used to prevent losing the precision of the cost function from the small number.

In order to consistently extract TVs for discerning the strength of a magnetic anomaly from the calibration data, one can use Algorithm (5).

  Algorithm  (5) Iteration:  for  [beginning  of  mag  calibration → end  of  mag  calibration] $\mspace{20mu}{{{{MatStr}_{i}\lbrack\;\ldots\;\rbrack} = {{\sqrt{\sum\limits_{axis}\left( {alignProcMAG}_{i} \right)}\mspace{14mu} i} = 1}},2,\ldots}$   end   min_MagStr_(i) = min (MagStr_(i))  i = 1, 2, …   max_MagStr_(i) = max (MagStr_(i))  i = 1, 2, …

In order to consistently extract TVs for discerning the angle between magnetometer and accelerometer vectors from the calibration data, one can use Algorithm (6).

  Algorithm  (6) Iteration:  for  [beginning  of  gyro  calibration → end  of  checking  routine]   Use  Extended  Kalman  Filter  to  estimation  the  orientation  during   the  calibration   q_(i)[ … ] = EKF(procGyro, procAcc, alignProcMAG_(i)),  i = 1, 2, … $\mspace{20mu}{{{e_{i}\lbrack\;\ldots\;\rbrack} = \begin{bmatrix} {q\; 2_{i}} & {q\; 3_{i}} & {q\; 4_{i}} \end{bmatrix}},{i = 1},2,\ldots}$ $\mspace{20mu}{{{{\hat{e}}_{i}\lbrack\;\ldots\;\rbrack} = \begin{bmatrix} 0 & {{- q}\; 4_{i}} & {q\; 3_{i}} \\ {q\; 4_{i}} & 0 & {{- q}\; 2_{i}} \\ {{- q}\; 3_{i}} & {q\; 2_{i}} & 0 \end{bmatrix}},{i = 1},2,\ldots}$   Rp_(i)[ … ] = (q 1_(i)² − e_(i)^(′)e_(i)) * I_(3 × 3) + 2(e_(i)e_(i)^(′)) − 2q 1_(i)ê_(i), i = 1, 2, …   MF_(i)[ … ] = Rp_(i) * alignProcMAG_(i), 1 = 1, 2, …   GF_(i)[ … ] = Rp_(i) * procAcc, i = 1, 2, … $\mspace{20mu}{{{\angle\;{{GM}_{i}\lbrack\;\ldots\;\rbrack}} = {{acos}\;\left\lbrack \frac{{MF}_{i} \cdot {GF}_{i}}{{{MF}_{i}}*{{GF}_{i}}} \right\rbrack}},{i = 1},2,\ldots}$   end $\mspace{20mu}{{\min\;\angle\;{TV\_ GM}_{i}} = {\overset{\_}{\angle\;{GM}_{\iota}} - {{tol}\; 1}}}$ $\mspace{20mu}{{\max\;\angle\;{TV\_ GM}_{i}} = {\overset{\_}{\angle\;{GM}_{\iota}} + {{tol}\; 2}}}$   Where:  tol 1  and  tol 2  are  tolerances  for  the  detection  threshold.

A magnetometer radii check calculation is performed on the calibrated magnetometer data before alignment. The radii of a normal point set should be equal to one. Algorithm (7) may be used to determine the radii threshold. As part of using Algorithm (7), a set of artificial points on a unit sphere are created or generated, where the set of points should be close to evenly distributed and have a minimum of 18 points. Using an ellipsoid fitting method on the artificial points, one can utilize the processed magnetometer data to determine the radii as set forth below Radii=ellipsoidFit([artificial points,procMAG _(i)], i=1,2 . . . minRadii=Radii−tol3 maxRadii=Radii+tol4  Algorithm (7) Where: tol3 and tol4 are tolerances for the detection threshold; and,

minRadii and maxRadii should be within 0.93 and 1.07 for applications that require high reliability.

Quaternion output discrepancies is a detection method that is based on the orientation output calculated from using different magnetometers. The following algorithm, Algorithm (8), may be used to determine the quaternion output discrepancies threshold, using the quaternions output from Algorithm (6), and calculate the angle between the quaternions. qDiff_(i,j)[ . . . ]=quatAngleDiff(q _(i)[ . . . ],q _(j)[ . . . ]), i≠j, i=1,2 . . . , j=1,2 . . . TV_qDiff_(i,j)= qDiff_(i,j)[ . . . ]+SSF7*std(qDiff_(i,j)[ . . . ]), i≠j, i=1,2 . . . , j=1,2  Algorithm (8)

After extracting the TVs for anomaly detection, the following calculation may be used to determine if the IMU is being affected by a local anomaly. As a prefatory step, all incoming sensor data may be processed using Equations 1-10 discussed previously. In addition, Algorithms (1) and (4) may be utilized to determine relative deviation among magnetometers within a preset kernel size. For the exemplary sensor fault detection system, the motion is detected based on the following rules in Table (1).

TABLE (1) Motion Detection based on sensors Activity Condition Result Gyro has detected If std(procGyro_(i)) > 

 , i = inertial_motion_detection = 1 motion 1, 2, . . . OR |procGyro _(i)| > 

 , i = 1, 2, . . . Accelerometer has If std(procAcc_(i)) > TV_(ACC) _(i) , i = 1, 2, . . . inertial_motion_detection = 1 detected motion Magnetometer has If std(procMAG_(i)) > TV_(MAG) _(i) , i = 1, 2, . . . Magnetic_motion_detection = 1 detected motion

Within the preset kernel size, the following rules in Table (2) are used to detect a motion anomaly.

TABLE (2) Motion anomaly detection Motion Anomaly Flag Condition False If Σinertial_motion_detection > 1 AND Σmagnetic_motion_detection > 1 False If Σinertial_motion_detection < 1 AND Σmagnetic_motion_detection < 1 True If Σinertial_motion_detection < 1 AND Σmagnetic_motion_detection > 1 False If Σinertial_motion_detection > 1 AND Σmagnetic_motion_detection < 1

The following rules in Table (3) are used to detect a magnetic anomaly.

TABLE (3) Magnetic Anomaly detection Magnetic Anomaly Flag Condition True costFunction > TV_(costFunction) False costFunction ≤ TV_(costFunction)

In accordance with the instant disclosure, one can calculate the magnetic strength using Algorithm (5). Thereafter, using the rules of Table (4), one can discern whether a magnetic anomaly is present.

TABLE (4) Magnetic strength anomaly detection Magnetic Strength Anomaly Flag Condition True MagStr_(i) < min_MagStr_(i) OR MagStr_(i) > max_MagStr_(i) False MagStr_(i) ≥ min_MagStr_(i) OR MagStr_(i) ≤ max_MagStr_(i)

In accordance with the instant disclosure, one can determine the angle between magnetometer and accelerometer vectors using Algorithm (6). This detection is only activated when the IMU/sensors is/are stationary, which is detected from the motion detection algorithm. Using the following table, Table (5), one can discern whether a magnetometer and accelerometer vector anomaly is present.

TABLE (5) magnetometer and accelerometer vectors anomaly detection MAG and ACC vectors Anomaly Flag Condition True ∠GM_(i) < min∠TV_GM_(i) OR ∠GM_(i) > max∠TV_GM_(i) False ∠GM_(i) ≥ min∠TV_GM_(i) OR ∠GM_(i) ≤ max∠TV_GM_(i)

In accordance with the instant disclosure, one can determine the magnetic radii by processing the raw data from the magnetometers using Algorithm (7). Using the following table, Table (6), one can discern whether a magnetic radii anomaly is present.

TABLE (6) Magnetic Radii anomaly detection Magnetic Radii Anomaly Flag Condition True radii < minRadii OR radii > maxRadii False radii ≥ minRadii OR radii ≤ maxRadii

In accordance with the instant disclosure, one can calculate the orientation of the IMUs with Algorithm (6) and calculate the angular difference with Algorithm (8). Using the following table, Table (7), one can discern whether a quaternion output discrepancy is present.

TABLE (7) Quaternion discrepancies detection Quaternion Discrepancies Flag Condition True qDiff_(i,j) > TV_qDiff_(i,j) False qDiff_(i,j) ≤ TV_qDiff_(i,j)

Anomaly detection can be weighted using the output from each of these sub-detection systems, and determine the relevant level of disturbance detected by the system. For systems requiring high levels of reliability, it should be considered an anomaly if any of these subsystem flags is detected.

The following discussion describes a process for calibrating an IMU when it is being used with or in proximity to a ferromagnetic object. One example, in the medical device field of use, is during surgical navigation, where the IMU is needed to track the motion of a ferromagnetic object (e.g., tools made from stainless steel, CoCr, etc). Since local environment calibration is performed presumably without these ferromagnetic objects in proximity, there is no way to compensate for their distortions during the local environment calibration stage. A secondary calibration step should be undertaken to correct the distortion when ferromagnetic objects will be used in proximity to the IMUs. The proposed method accounts for the fact that an IMU may be rigidly fixed to the ferromagnetic object when in use.

While it is possible to manually maneuver the IMU attached to the ferromagnetic object to collect a lump sum of data for re-calibration, this method is inefficient and requires a substantial amount of time for the user to repeat the maneuver for each ferromagnetic object needing calibration. Secondly, it is possible that the calibration of the combined effect of the local environment and the ferromagnetic object is not aligned with the calibration of the local environment alone. Though either of the calibrations may be functional for yaw tracking, the latent transformation between calibrations on the reference field can produce errors. By way of example, one may think of it as comparing the reading of two compasses, one being horizontal to the ground, the other being tilted 5 degrees. The horizontal compass is calibrated to the local environment, while the other compass is calibrated with both ferromagnetic objects and local environment. While both calibrations are both functional, the reading from each compass will be different. Accordingly, an exemplary algorithm of the instant disclosure addresses both of these issues.

The instant approach makes use of the distortion characteristic of low field strength ferromagnetic objects, and models the correction based on a limited amount of data input. This enables a much simpler calibration maneuver, while still being able to achieve reasonable calibration.

Referring to FIGS. 1-3, the object 100 attached to the IMU 102 (or the IMU 102 by itself) is moved through a series of orientations—which can be confirmed from the IMU data. From the collected data, an initial estimation of the distortion field can be calculated through standard ellipsoid processing and analysis. A reference dataset (currently using 25000 vectors) is drawn from a von-Mises Fisher density, thereby creating a set of uniformly distributed vectors around the IMU sphere. The magnetic distortion calculated during the local environment calibration, and the initial estimation of magnetic distortion with the ferromagnetic object are applied in reverse to the reference dataset. This creates two datasets: (1) a reference dataset being distorted by the local environment; and, (2) a reference dataset being distorted by both the local environment and the attached ferromagnetic object 100 (or ferromagnetic object in proximity to the IMU 102). Since all the points between these two datasets originate from the same reference dataset, a point-to-point correspondence between local environment distortion, and local environment distortion with the ferromagnetic object is established. The correction for the ferromagnetic object is then extracted from the latter using a recursive optimization algorithm with the prior dataset.

This exemplary calibration process can be used for any number of objects, so that multiple objects which have latent magnetic fields can be used with the magnetometer without compromising sensor accuracy, as well as maintain a consistent reference field.

The following section outlines the algorithm for calibrating a ferromagnetic object with a pre-calibrated IMU. This part assumes that the IMU has been calibrated according to the foregoing discussion. The IMU, as part of this calibration sequence, should be rigidly attached to the tool or otherwise have the tool in a constant position with respect to the IMU. The operator rotates the object for at least one revolution along each axis in a standard Cartesian system as depicted in FIGS. 1-3. Once the tool calibration dataset is collected, the following algorithm can calculate and compensate the distortion.

As an initial matter, an initial guess is made as to the center offset of the data set using Equation 13 below.

$\begin{matrix} {{SFe}_{{inst}_{i}},{{HFe}_{{inst}_{i}} = {EF}_{{fun}{({DATA}_{{mag}_{i}})}}},{i = 1},2,\ldots} & {{Equation}\mspace{14mu} 13} \end{matrix}$

Thereafter, a large number (e.g., 25,000) of random 3D unit vectors are generated and application of the inverse of the original and instrument SFe on to them using Algorithm (9) below. Iteration: for 1 . . . 25000 samples=rand3Dvectors samples_(distorted) _(i) =samples*inv(SFe _(inst) _(i) ), i=1,2, . . . samples_(normal) _(i) =samples*inv(SFe _(orig) _(i) ), i=1,2, . . . End  Algorithm (9)

Using Equation 14, shown below, calculate the point correspondence transformation. T _(i) _(→N) =samples_(normal) _(i) \samples_(distorted) _(i) , i=1,2,  Equation 14

Using Equation 15, shown below, calculate the point-to-point distortion distance. Diff_(ND) _(i) =samples_(normal) _(i) −samples_(distorted) _(i) , i=1,2,  Equation 15

Using Equation 16, shown below, for each axis, locate the maximum negative of Diff_(ND). loc_(i)=minmax(Diff_(ND) _(i) ), i=1,2,  Equation 16

Using Equation 17, shown below, calculate the index location of loc.

The index location of loc is ind_(i)=index(minmax(Diff_(ND) _(i) )), i=1,2,  Equation 17

Using Equation 18, shown below, calculate the center along the maximum distortion distance axes. c _(i)=min(loc_(i))+max(loc_(i)), i=1,2,  Equation 18

Using Equation 19, shown below, calculate the maximum correction boundaries. D _(bound) _(i) =samples_(distorted) _(i) (ind_(i)), i=1,2,  Equation 19

Using Equation 20, shown below, after the distortion compensation parameters are calculated, center the instrument calibration dataset. centerMAG _(i)=DATA_(mag) _(i) −HFe _(inst) _(i) , i=1,2,  Equation 20

The foregoing calibration correction can be applied in at least two ways. In a first fashion, the calibration correction is applied using a point correspondence transformation, such as Equation 21 shown below. compensatedMAG _(i)=centerMAG _(i)*inv(T _(i) _(D→N) ) i=1,2,  Equation 21

Alternatively, in a second fashion, the calibration correction is applied using geometric scaling and compensation, such as by using Equations 22 and 23.

$\begin{matrix} {{{S\;{F_{i}\left( {X,Y,Z} \right)}} = \frac{\begin{matrix} {{{centerMAG}_{i}\left( {X,Y,Z} \right)} - {{c\left( {X,Y,Z} \right)} \cdot}} \\ {{{Dbound}_{i}\left( {X,Y,Z} \right)} - {c\left( {X,Y,Z} \right)}} \end{matrix}}{\begin{matrix} {{{norm}\left( {{{centerMAG}_{i}\left( {X,Y,Z} \right)} - {c\left( {X,Y,Z} \right)}} \right)} \cdot} \\ {{norm}\left( {{{Dbound}_{i}\left( {X,Y,Z} \right)} - {c\left( {X,Y,Z} \right)}} \right)} \end{matrix}}},\mspace{20mu}{i = 1},2,\ldots} & {{Equation}\mspace{14mu} 22} \\ {{{ccompensatedMAG}_{i} = {{centerMAG}_{i} + {{loc}_{i}*{SF}_{i}}}},{i - 1},2,\ldots} & {{Equation}\mspace{14mu} 23} \end{matrix}$

Using equation 24, the adjusted calibration parameters may be calculated. SFe _(adjInst) _(i) ,HFe _(adjInst) _(i) =magCal(compensatedMAG _(i)), i=1,2,  Equation 24

Post conclusion of the foregoing calibration computations, the calibration computations may be applied to the magnetometers of each IMU that is attached to the ferromagnetic object or will be in a fixed positional relationship thereto. In order to apply the calibration computations to the magnetometers of each IMU, the magnetometer data is centered using Equation 20. By way of example, on may apply the correction to account for the distortion cause by the tool via a point correspondence transformation using Equation 21, or apply the geometric scaling and compensation using Equations 22 and 23. Thereafter, the magnetometers of the IMU can be processed by applying the adjusted soft and hard iron compensation parameters via Equation 25, shown below.

$\begin{matrix} {{{procMAG}_{i} = {{processMag}\left( {{compensatedMAG}_{i},{SFe}_{{adjInst}_{i}},{HFe}_{{adjIinst}_{i}}} \right)}},\mspace{20mu}{i = 1},2,\ldots} & {{Equation}\mspace{14mu} 25} \end{matrix}$

Once the magnetometers have been processed, the magnetometers are aligned using Equations 9 and 10

Following from the above description, it should be apparent to those of ordinary skill in the art that, while the methods and apparatuses herein described constitute exemplary embodiments of the present invention, the invention described herein is not limited to any precise embodiment and that changes may be made to such embodiments without departing from the scope of the invention as defined by the claims. Additionally, it is to be understood that the invention is defined by the claims and it is not intended that any limitations or elements describing the exemplary embodiments set forth herein are to be incorporated into the interpretation of any claim element unless such limitation or element is explicitly stated. Likewise, it is to be understood that it is not necessary to meet any or all of the identified advantages or objects of the invention disclosed herein in order to fall within the scope of any claims, since the invention is defined by the claims and since inherent and/or unforeseen advantages of the present invention may exist even though they may not have been explicitly discussed herein. 

What is claimed is:
 1. A method of calibrating an inertial measurement unit, the method comprising: collecting data from the inertial measurement unit, while stationary as a first step, in a local environment where the inertial measurement unit is anticipated to be used post calibration; collecting data from the inertial measurement unit while repositioning the inertial measurement unit around three orthogonal axes of the inertial measurement unit as a second step in the local environment; calibrating a plurality of gyroscopes using the data collected during the first step and the second step; calibrating a plurality of magnetometers using the data collected during the first step and the second step; calibrating a plurality of accelerometers using the data collected during the first step and the second step; where calibrating the plurality of magnetometers includes forming a cost function using deviations in data, from the plurality of magnetometers, from an assumption that at least one of an angle and a length of each of the plurality of magnetometers are identical; and, where calibrating the plurality of magnetometers includes establishing a threshold for the cost function beyond which an unaccounted for magnetic distortion exists.
 2. The method of claim 1, wherein calibrating the plurality of magnetometers includes extracting parameters for distortion detection adopting at least one of the following assumptions: (1) motion of the inertial measurement unit is detectable by all of the plurality of accelerometers, the plurality of gyroscopes, and the plurality of magnetometer comprising the inertial measurement unit; (2) an angle and a length of the plurality of magnetometers have approximately identical values; (3) each of a plurality of magnetometer vectors is approximately unity in magnitude; (4) an angle between a calibrated magnetometer vector and a calibrated accelerometer vector should not change; (5) a radius of the plurality of magnetometers post calibration is approximately equal to one; and, (6) quaternions calculated using different ones of the plurality of magnetometers are approximately equal.
 3. The method of claim 2, wherein a deviation from the assumption that motion of the inertial measurement unit is detectable by all of the plurality of accelerometers, the plurality of gyroscopes, and the plurality of magnetometers comprising the inertial measurement unit, results in a determination of a motion anomaly.
 4. The method of claim 3, wherein a deviation from any one of the following assumptions results in a determination of a magnetic anomaly: (2) an angle and a length of the plurality of magnetometers have approximately identical values; (3) each of a plurality of magnetometer vectors is approximately unity in magnitude; (4) an angle between a calibrated magnetometer vector and a calibrated accelerometer vector should not change; (5) a radius of the plurality of magnetometers post calibration is approximately equal to one; and, (6) quaternions calculated using different ones of the plurality of magnetometers are approximately equal.
 5. The method of claim 1, wherein calibrating the plurality of gyroscopes includes determining a bias of each gyroscope by arithmetic mean.
 6. The method of claim 1, wherein calibrating the plurality of magnetometers includes determining whether at least one of any hard iron distortion is present and any hard iron distortion is present.
 7. The method of claim 6, wherein determining whether at least one of any hard iron distortion is present and any hard iron distortion is present includes utilizing a multi-dimensional ellipsoidal fitting function to the data collected from the plurality of magnetometers.
 8. The method of claim 1, wherein calibrating the plurality of magnetometers includes accounting for alignment differences among the magnetometers from a reference alignment.
 9. The method of claim 1, wherein calibrating the plurality of magnetometers includes calibrating the plurality of magnetometers to a new reference alignment.
 10. The method of claim 1, wherein calibrating the plurality of accelerometers includes applying a multi-dimensional ellipsoidal fitting function to the data collected from the plurality of accelerometers.
 11. The method of claim 1, wherein calibrating the plurality of gyroscopes includes extracting parameters for distortion detection and using the extracted parameters to determine if a motion anomaly is present.
 12. The method of claim 1, wherein calibrating the plurality of accelerometers includes verifying that the data collected from the plurality of accelerometers in the second step has a motion value greater than the data collected from the plurality of accelerometers in the first step.
 13. The method of claim 1, wherein calibrating the plurality of gyroscopes includes verifying that the data collected from the plurality of gyroscopes in the second step has a motion value greater than the data collected from the plurality of gyroscopes in the first step.
 14. The method of claim 1, wherein calibrating the plurality of magnetometers includes verifying that the data collected from the plurality of magnetometers in the second step has a motion value greater than the data collected from the plurality of magnetometers in the first step.
 15. The method of claim 1, wherein calibrating the plurality of magnetometers includes applying a multi-dimensional ellipsoidal fitting function to the data collected from the plurality of magnetometers.
 16. The method of claim 1, wherein calibrating the plurality of magnetometers includes calculating orientation output quaternions from the data collected from the plurality of magnetometers.
 17. The method of claim 16, wherein calibrating the plurality of magnetometers includes calculating an angle between the calculated orientation output quaternions.
 18. The method of claim 1, wherein calibrating the plurality of magnetometers includes applying a magnetometer radii calculations to the data collected from the plurality of magnetometers to determine if a magnetic anomaly exists.
 19. The method of claim 18, wherein if the magnetic anomaly exists, calculating a strength of the magnetic anomaly.
 20. An inertial measurement unit calibrated according to claim
 1. 21. An inertial measurement unit incorporated as part of a surgical navigation system calibrated according to claim
 1. 22. A method of verifying data reliability from an inertial measurement unit, the method comprising: collecting data from a plurality of accelerometers, a plurality of gyroscopes, and a plurality of magnetometers of an inertial measurement unit; detecting whether a motion anomaly is present using a motion anomaly rule set comprising: the motion anomaly is not present if a sum of data from the plurality of accelerometers is greater than one and a sum of data from the plurality of magnetometers is greater than one, the motion anomaly is not present if a sum of data from the plurality of accelerometers is less than one and a sum of data from the plurality of magnetometers is less than one, the motion anomaly is present if a sum of data from the plurality of accelerometers is less than one and a sum of data from the plurality of magnetometers is greater than one, and the motion anomaly is not present if a sum of data from the plurality of accelerometers is greater than one and a sum of data from the plurality of magnetometers is less than one; where detection of inertial motion by each of the plurality of accelerometers equals one and an absence of motion by each of the plurality of accelerometers equals zero; where detection of magnetic motion by each of the plurality of magnetometers motion equals one and an absence of magnetic motion by each of the plurality of accelerometers equals zero; and, disregarding data collected from the plurality of accelerometers and the plurality of gyroscopes for a predetermined period upon detecting a motion anomaly. 